package com.sunagy.demand.front.service.impl;

import com.sunagy.demand.front.dataobject.CustomerAuthToken;
import com.sunagy.demand.front.dataobject.CustomerUser;
import com.sunagy.demand.front.dto.CustomerUserDto;
import com.sunagy.demand.front.repository.CustomerAuthTokenRepository;
import com.sunagy.demand.front.repository.CustomerUserRepository;
import com.sunagy.demand.front.service.CustomerUserService;
import com.sunagy.demand.front.utils.BeanUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * desc：#TODO fill me ！
 * author：三餘無夢生
 * date：2018/4/27
 * time：上午11:24
 */
@Service
public class CustomerUserServiceImpl implements CustomerUserService {

    @Autowired
    private CustomerUserRepository customerUserRepository;

    @Autowired
    private CustomerAuthTokenRepository customerAuthTokenRepository;

    @Override
    public CustomerUserDto getUser(Integer userId) {
        CustomerUser customerUser = customerUserRepository.getOne(userId);
        CustomerUserDto customerUserDto = new CustomerUserDto();
        BeanUtils.copyProperties(customerUser,customerUserDto);
        return customerUserDto;
    }

}
